// test_css3.js
// by SJX
// entry_function: start_css3_test()

function get_style(i,kind){
	if (window.getComputedStyle){
		return window.getComputedStyle(i,null).getPropertyValue(kind);
	}
	 if (i.currentStyle)
		return i.currentStyle[kind];
}
function style_in_element(i,kind){
	var result;
	if(get_style(i,kind))
		return true;
	if(get_style(i,"-webkit-"+kind))
		return true;
	if(get_style(i,"-moz-"+kind))
		return true;
	if(get_style(i,"-o-"+kind))
		return true;
	if(get_style(i,"-ms-"+kind))
		return true;
	return false;
}

$sie = style_in_element;

function result_property_test(result){
	//TODO replace with sandbox
	var i=document.createElement("div");
	document.body.appendChild(i);

	result["layout"] = {
		layerName:	"Layout",
		type:"aggrg",
		nlist: {
			"overflow-x": style_in_element(i,"overflow-x")
		}
	};

	result["border"] = {
		layerName: "Border",
		type:"aggrg",
		nlist: {
			"border-colors": style_in_element(i, "border-top-colors"),
			"border-image":  style_in_element(i, "border-image"),
			"border-radius": style_in_element(i, "border-top-left-radius"),
			"box-shadow":	$sie(i, "border-top-left-radius")
			//TODO need to examine catagory
		}
	};

	//result["box-shadow"] = style_in_element(i, "box-shadow");

	result["background"] = {
		layerName: "Background",
		type: "aggrg",
		nlist: {
			"background-origin": 	style_in_element(i,"background-origin"),
			"background-clip": 		style_in_element(i,"background-clip"),
			"background-size": 		style_in_element(i,"background-size"),
			"multiple backgrounds": "no idea temporarily"
			//TODO weiwei, no idea???
		}
	};

	result["color"] = {
		layerName: "Color",
		type: "aggrg",
		nlist: {
			opacity: style_in_element(i,"opacity"),
			//TODO complement
		}
	};

	result["text"] = {
		layerName: "Text",
		type:"aggrg",
		nlist: {
			"text-overflow": 	style_in_element(i, "text-overflow"),
			"text-shadow": 		style_in_element(i,"text-shadow"),
			"word-wrap": 		style_in_element(i, "word-wrap") 
		}
	};

	result["user_interface"] = {
		layerName: "User Interface",
		type: "aggrg",
		nlist: {
			"outline-offset": 	style_in_element(i,"outline-offset"),
			"nav-index":		style_in_element(i, "nav-index"),
			"box-sizing":		style_in_element(i,"box-sizing"),
			"resize":			style_in_element(i,"resize")
		}
	}

	result["multi-column"] = {
		layerName: "Multi-Column",
		type:	"aggrg",
		nlist: {
			"column-width": 	style_in_element(i, "column-width"),
			"column-count": 	style_in_element(i, "column-count"),
			"column-gap": 		style_in_element(i, "column-gap"),
			"column-rule": 		style_in_element(i, "column-rule"),
			"column-span": 		style_in_element(i, "column-span"),
			"column-fill": 		style_in_element(i, "column-fill"),
			"column-gap": 		style_in_element(i, "column-gap"),
			"column-break-before": 	style_in_element(i, "column-break-before"),
			"column-break-after": 	style_in_element(i, "column-break-after"),
			"column-break-inside": 	style_in_element(i, "column-break-inside"),
		}
	};

	result["transform"] = {
		layerName: "Transform",
		type: 		"aggrg",
		nlist: {
			transform:			$sie(i, "transform"),
			"transform-origin":	$sie(i, "transform-origin")
		}
	};

	result["transition"] = {
		layerName: "Transition",
		type:		"aggrg",
		nlist: {
			"transition-property": 		$sie(i, "transition-property"),
			"transition-duration": 		$sie(i, "transition-duration"),
			"transition-timing-function": $sie(i, "transition-timing-function"),
			"transition-delay": 		$sie(i, "transition-delay"),

		}
	};
}

function start_css3_test()
{
	var E = {
		layerName: "CSS3 Fundamental",
		type: "aggrg",
		nlist: {}
	};
	result_property_test(E.nlist);
	return E;
}
